package IO;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Microsoft
 * Date: 2023-07-26
 * Time: 15:04
 */
public class IODemo2 {
    public static void main(String[] args) throws IOException {
        //在相对路径中，./通常也可以省略
        File file = new File("./hello_world.txt");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

        //创建文件
        file.createNewFile();//这里需要抛出一个异常
        System.out.println("===========");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

        file.delete();
    }
}




















